import axios from '@/utils/axios'
import type { Result, PageVO, CommentVO, CommentAddReq, CommentQueryReq } from '@/types'

// 评论相关接口
export const commentApi = {
  // 添加评论或回复
  addComment(data: CommentAddReq) {
    return axios.post<Result<boolean>>('/comment/add', data)
  },

  // 删除评论
  deleteComment(id: number) {
    return axios.delete<Result<boolean>>(`/comment/del?id=${id}`)
  },

  // 标记所有评论已读
  markAllRead(userId: number) {
    return axios.get<Result<boolean>>(`/comment/markAllRead?userId=${userId}`)
  },

  // 标记评论已读
  markRead(id: number) {
    return axios.get<Result<boolean>>(`/comment/markRead?id=${id}`)
  },

  // 分页查询评论
  pageQuery(params: CommentQueryReq) {
    return axios.post<Result<PageVO<CommentVO>>>('/comment/page/query', params)
  },
}
